package com.usefullc.blog.enums;


import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.StringUtils;

/**
 * 文章状态
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum ArticleStatusEnum {


    DRAFT(0, "草稿"),

    RELEASED(1, "已发布"),

    OFF_SHELF(2, "已下架"),



    ;


    private int code;
    private String value;

    ArticleStatusEnum(int code, String value) {
        this.code = code;
        this.value = value;
    }



    public static ArticleStatusEnum getByCode(int code) {
        for (ArticleStatusEnum s : ArticleStatusEnum.values()) {
            if (s.getCode() == code) {
                return s;
            }
        }
        return null;
    }


    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getValue() {


        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

}
